﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DemoforGit
{
    /// <summary>
    /// 方块
    /// </summary>
    class Blocks
    {
        public Rectangle Rectangle { get; set; }

        private int SpeedX;
        private int SpeedY;

        public Blocks(Rectangle rec)
        {
            Rectangle = rec;
            SpeedX = -2;
            SpeedY = 0;

        }
        public void Draw(Graphics g)
        {
            g.DrawImage(Properties.Resources.bg1, Rectangle);
           
        }

        public void Move()
        {
            this.Rectangle = new Rectangle(Rectangle.X + SpeedX,
                 Rectangle.Y+SpeedY, Rectangle.Width,Rectangle.Height);

            if(this.Rectangle.X<0)
            {
                this.Rectangle = new Rectangle(1000,
                    this.Rectangle.Y, Rectangle.Width, Rectangle.Height);
                SpeedX *= 1;
            }

        }
    }
}
